package secondriver.heathfood.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import secondriver.heathfood.R;
import secondriver.heathfood.bean.FoodClass;

import java.util.List;

/**
 * Author : secondriver
 * Date :  2015/10/29
 */
public class FoodClassSpinnerListAdapter extends FoodClassListAdapter {

    public FoodClassSpinnerListAdapter(Context context, List<FoodClass> data) {
        super(context, data);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder.FoodClassTopViewHolder viewHolder = null;
        if (view == null) {
            view = inflater.inflate(R.layout.spinner_item_food_class, viewGroup, false);
            viewHolder = new ViewHolder.FoodClassTopViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder.FoodClassTopViewHolder) view.getTag();
        }
        FoodClass foodClass = data.get(i);
        viewHolder.setContent(foodClass);
        return view;
    }
}
